<%--
  Created by IntelliJ IDEA.
  User: 范军建
  Date: 2022/3/29
  Time: 21:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body

>
<%
    Cookie[] cook = request.getCookies();//获取本地所有的Cookie对象
    String[] userMessage = new String[] { "", "" }; //用户存储从cookie中获取的用户名和密码
    if (cook != null) {
        for (int i = 0; i < cook.length; i++) {
            if (cook[i].getName().equals("userInfo")) {
                userMessage = cook[i].getValue().split("#");//通过分割split获取用户名和密码.
            }

        }
    }
%>
<form action="check.jsp" method="post">
    <table>
        <tr>
            <td>用户名:</td>
            <td><input name="userName" type="text"
                       value="<%=userMessage[0]%>"></td>
        </tr>
        <tr>
            <td>密码</td>
            <td><input type="password" name="password"
                       value="<%=userMessage[1]%>"></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td colspan="2" align="center"><input type="submit" value="提交">&nbsp;<input
                    type="reset" value="重置"></td>
        </tr>
    </table>
</form>

</body>
</html>
